package com.bgw.boot.api;

import com.bgw.boot.entity.User;
import com.bgw.boot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wg
 * @date 2020/9/6 22:45
 * @email 965178085@qq.com
 * @description
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/getAll")
    public List<User> getAll(){
        return userService.getAll();
    }

    @GetMapping("/getById")
    public User getById(@RequestParam("id") long id){
        return userService.getById(id);
    }
}
